package com.xin.di.uav.applet.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xin.di.uav.mapper.OrderCommodityMapper;
import com.xin.di.uav.po.OrderCommodity;
import com.xin.di.uav.applet.service.IOrderCommodityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 订单商品关联表 服务实现类
 * </p>
 *
 * @author LTQ
 * @since 2023-12-12
 */
@Service
public class OrderCommodityServiceImpl extends ServiceImpl<OrderCommodityMapper, OrderCommodity> implements IOrderCommodityService {
    @Autowired
    private OrderCommodityMapper orderCommodityMapper;

    @Override
    public List<OrderCommodity> getByOrderSn(String orderSn) {
        QueryWrapper<OrderCommodity> orderCommodityQueryWrapper = new QueryWrapper<>();
        orderCommodityQueryWrapper.eq("order_sn", orderSn);
        return orderCommodityMapper.selectList(orderCommodityQueryWrapper);
    }

    @Override
    public List<OrderCommodity> getByOrderSns(List<String> orderSns) {
        QueryWrapper<OrderCommodity> orderCommodityQueryWrapper = new QueryWrapper<>();
        orderCommodityQueryWrapper.lambda().in(OrderCommodity::getOrderSn, orderSns);
        return orderCommodityMapper.selectList(orderCommodityQueryWrapper);
    }
}
